class Solution(object):
    def toGoatLatin(self, sentence):
        """
        :type sentence: str
        :rtype: str
        """
        def convert(index, word):
            if word[0] in {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}:
                return word + 'ma' + 'a' * (index + 1)
            else:
                return word[1:] + word[0] + 'ma' + 'a' * (index + 1)
        s = sentence.split(' ')
        s = [convert(index, word) for index, word in enumerate(s)]
        return ' '.join(s)